package com.taomeng.entity;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

@Data
public class RespBody {
    private Integer code;
    private String msg;
    private Long count;
    private List data;
    public static void JsonObject(HttpServletResponse resp, RespBody respBody) throws IOException {

        String json = new ObjectMapper().writeValueAsString(respBody);

        resp.setContentType("text/plain");
        resp.setCharacterEncoding("gb2312");
        PrintWriter out = new PrintWriter(resp.getOutputStream());
        out.print(json);
        out.flush();
    }
}
